<!DOCTYPE html>
<html lang="en">
<head>
	<include file="Public:header2" />
	<title>{:C('web_title')}</title>
</head>
<body class="blackbg">
    <div id="container" class="logbg">
        <div class="log_title">
            <span class="back"><a href="javascript:history.go(-1)"></a></span>
            <if condition="$user['mibao_question'] eq '' || $user['mibao_question'] eq null">
				{$Think.lang.g_mibao_set}
			<else />
				{$Think.lang.User_upmbwt}
			</if>
        </div>
        <if condition="$user['mibao_question'] eq '' || $user['mibao_question'] eq null">
        <div class="logbot">
			<select id="new_mibao_question" class="logipt">
				<option value="">{$Think.lang.User_xzmbwt}</option>
				<option value="你父亲的姓名">{$Think.lang.User_father}</option>
				<option value="你母亲的姓名">{$Think.lang.User_mather}</option>
				<option value="你爱人的姓名">{$Think.lang.User_love}</option>
				<option value="你的出生日期">{$Think.lang.User_birthday}</option>
				<option value="你父亲的出生日期">{$Think.lang.User_fatherday}</option>
				<option value="你母亲的出生日期">{$Think.lang.User_matherday}</option>
				<option value="你爱人的出生日期">{$Think.lang.User_loveday}</option>
			</select>

			<input type="text" id="new_mibao_answer" class="logipt" placeholder="问题答案" />
		  
			<div class="words">
				<label>{$Think.lang.g_mibao_guanlian}：</label>
				<div class="iptbox" style="line-height:38px;font-size:14px;">
					<input type="checkbox" id="findpwd_mibao" <if condition="$user['findpwd_mibao']==1">checked="checked"</if> /> {$Think.lang.g_mibao_pwd}
				
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				
					<input type="checkbox" id="findpaypwd_mibao" <if condition="$user['findpaypwd_mibao']==1">checked="checked"</if> /> {$Think.lang.Login_backpwd}
				</div>
			</div>
				
			<!--<select id="chkstyle" class="logipt">
				<option value="">请选择验证方式</option>
				<option value="mobile">手机号码验证</option>
				<option value="email">邮箱验证</option>
			</select>-->
			  
			<!--<div class="yzmbox" id="mobile_div" style="display:none;">
				<input type="text" id="mobile_verify" placeholder="短信验证码" class="logipt yzmipt" maxlength="6" />
				<input type="button" id="regBtn" onclick="SendCode()" value="点击获取验证码" class="phonebut" />
				<if condition="$user['mobile'] eq '' || $user['mobile'] eq null">
					<p class="attention">您没有绑定手机，请先绑定手机或换成其它验证方式</p>
				<else />
					<p class="attention">* 您接收短信的手机是{$user['mobile']|addstar=###,mobile}</p>
				</if>
			</div>-->
			  
			<div class="yzmbox" id="email_div">
				<input type="text" id="email_verify" value="" class="logipt yzmipt" maxlength="6" placeholder="{$Think.lang.g_yx_verify}" />
				<input type="button" id="regBtn" onclick="EmCode()" value="{$Think.lang.Finance_hqyzm2}" class="phonebut" />
				<if condition="$user['email'] eq '' || $user['email'] eq null">
					<p class="attention">您没有绑定邮箱，请先绑定邮箱或换成其它验证方式</p>
				<else />
					<p class="attention">* {$Think.lang.g_pwd_yx_recode}{$user['email']|addstar=###,email}</p>
				</if>
			</div>
			<input type="button" class="logbut" id="btn-submit" value="{$Think.lang.User_save}" title="{$Think.lang.User_save}" onclick="Update1()"/>
        </div>
        <else />
        <div class="logbot">
			<select id="mibao_question" class="logipt">
				<option value="">{$Think.lang.User_xzmbwt}</option>
				<option value="你父亲的姓名">{$Think.lang.User_father}</option>
				<option value="你母亲的姓名">{$Think.lang.User_mather}</option>
				<option value="你爱人的姓名">{$Think.lang.User_love}</option>
				<option value="你的出生日期">{$Think.lang.User_birthday}</option>
				<option value="你父亲的出生日期">{$Think.lang.User_fatherday}</option>
				<option value="你母亲的出生日期">{$Think.lang.User_matherday}</option>
				<option value="你爱人的出生日期">{$Think.lang.User_loveday}</option>
			</select>

			<input type="text" id="mibao_answer" class="logipt" placeholder="{$Think.lang.User_wtda}" />

			<select id="new_mibao_question" class="logipt">
				<option value="">{$Think.lang.User_xzmbwt}</option>
				<option value="你父亲的姓名">{$Think.lang.User_father}</option>
				<option value="你母亲的姓名">{$Think.lang.User_mather}</option>
				<option value="你爱人的姓名">{$Think.lang.User_love}</option>
				<option value="你的出生日期">{$Think.lang.User_birthday}</option>
				<option value="你父亲的出生日期">{$Think.lang.User_fatherday}</option>
				<option value="你母亲的出生日期">{$Think.lang.User_matherday}</option>
				<option value="你爱人的出生日期">{$Think.lang.User_loveday}</option>
			</select>

			<input type="text" id="new_mibao_answer" class="logipt" placeholder="{$Think.lang.User_xmbwtda}" />
		  
			<div class="words">
				<label>{$Think.lang.g_mibao_guanlian}：</label>
				<div class="iptbox" style="line-height:38px;font-size:14px;">
					<input type="checkbox" id="findpwd_mibao" <if condition="$user['findpwd_mibao']==1">checked="checked"</if> /> {$Think.lang.g_mibao_pwd}
				
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				
					<input type="checkbox" id="findpaypwd_mibao" <if condition="$user['findpaypwd_mibao']==1">checked="checked"</if> /> {$Think.lang.Login_backpwd}
				</div>
			</div>
		  
			<!--<select id="chkstyle" class="logipt">
				<option value="">请选择验证方式</option>
				<option value="mobile">手机号码验证</option>
				<option value="email">邮箱验证</option>
			</select>-->

			<!--<div class="yzmbox" id="mobile_div" style="display:none;">
				<input type="text" id="mobile_verify" value="" class="logipt yzmipt" placeholder="短信验证码" />
				<input type="button" id="regBtn" onclick="SendCode()" value="点击获取验证码" class="phonebut" />
				<if condition="$user['mobile'] eq '' || $user['mobile'] eq null">
					<p class="attention">您没有绑定手机，请先绑定手机或换成其它验证方式</p>
				<else />
					<p class="attention">* 您接收短信的手机是{$user['mobile']|addstar=###,mobile}</p>
				</if>
			</div>-->
		  
			<div class="yzmbox" id="email_div">
				  <input type="text" id="email_verify" value="" class="logipt yzmipt" maxlength="6" placeholder="{$Think.lang.g_yx_verify}" />
				  <input type="button" id="regBtn" onclick="EmCode()" value="{$Think.lang.Finance_hqyzm2}" class="phonebut">
				  <if condition="$user['email'] eq '' || $user['email'] eq null">
					<p class="attention">您没有绑定邮箱，请先绑定邮箱或换成其它验证方式</p>
				  <else />
					<p class="attention">* {$Think.lang.g_pwd_yx_recode}{$user['email']|addstar=###,mobile}</p>
				  </if>
			</div>

			<input type="button" class="logbut" id="btn-submit" value="{$Think.lang.User_save}" title="{$Think.lang.User_save}" onclick="Update()"/>
        </div>
        </if>
    </div>
<script type="text/javascript">
function SendCode() {
  var chkstyle = $("#chkstyle").val();
  if(!chkstyle || chkstyle != 'mobile'){
	layer.tips('您选择的验证方式不是短信验证', '#chkstyle', {
        tips: 3
    });
    return false;
  }
  layer.load(0, {shade: [0.5,'#8F8F8F']});
    $('#regBtn').attr("disabled", "disabled");
    $.post("{:U('Verify/mibao')}", {}, function (data) {
    layer.closeAll();
      if (data.status == 1) {
        layer.msg(data.info, {
          icon: 1
        });
        var obj = $('#regBtn');
        var wait = 120;
        var interval = setInterval(function () {
          obj.css('backgroundColor', '#f6f6f6');
          obj.val(wait + '{$Think.lang.sFinance_myzc_mzcfs}');
          wait--;
          if (wait < 0) {
            obj.removeAttr("disabled");
            clearInterval(interval);
            obj.val('{$Think.lang.sFinance_myzc_hqyzm}');
            obj.css('backgroundColor', '#f6f6f6');
          }
          ;
        }, 1000);
      } else {
        $('#regBtn').removeAttr("disabled");
        layer.msg(data.info, {
          icon: 2
        });
      }
    }, "json");
}

function EmCode() {
  var chkstyle = 'email';
  if(!chkstyle || chkstyle != 'email'){
	layer.tips('您选择的验证方式不是邮箱验证', '#chkstyle', {
        tips: 3
    });
    return false;
  }
  layer.load(0, {shade: [0.5,'#8F8F8F']});
    $('#regBtn').attr("disabled", "disabled");
    $.post("{:U('Verify/mibaoemail')}", {}, function (data) {
    layer.closeAll();
      if (data.status == 1) {
        layer.msg(data.info, {
          icon: 1
        });
        var obj = $('#regBtn');
        var wait = 120;
        var interval = setInterval(function () {
          obj.css('backgroundColor', '#f6f6f6');
          obj.val(wait + '{$Think.lang.sFinance_myzc_mzcfs}');
          wait--;
          if (wait < 0) {
            obj.removeAttr("disabled");
            clearInterval(interval);
            obj.val('{$Think.lang.sFinance_myzc_hqyzm}');
            obj.css('backgroundColor', '#f6f6f6');
          }
          ;
        }, 1000);
      } else {
        $('#regBtn').removeAttr("disabled");
        layer.msg(data.info, {
          icon: 2
        });
      }
    }, "json");
}

  function Update(){
    var mibao_question=$("#mibao_question").val();
    var mibao_answer=$("#mibao_answer").val();
    var new_mibao_question=$("#new_mibao_question").val();
    var new_mibao_answer=$("#new_mibao_answer").val();
	var chkstyle = 'email';
	if($("#findpwd_mibao").attr("checked") == "checked"){
		var findpwd_mibao = 1;
	}else{
		var findpwd_mibao = 0;
	}
	if($("#findpaypwd_mibao").attr("checked") == "checked"){
		var findpaypwd_mibao = 1;
	}else{
		var findpaypwd_mibao = 0;
	}
	if(!chkstyle){
		layer.tips('您选择验证方式！', '#chkstyle', {
			tips: 3
		});
		return false;
	}
/*    var mobile_verify = $("#mobile_verify").val();
    if (chkstyle == 'mobile' && (mobile_verify == "" || mobile_verify == null)) {
      layer.tips('请输入短信验证码', '#mobile_verify', {
        tips: 3
      });
      return false;
    }*/
	var email_verify = $("#email_verify").val();
    if (chkstyle == 'email' && (email_verify == "" || email_verify == null)) {
      layer.tips('{$Think.lang.sFinance_myzc_qsryxyzm}', '#email_verify', {
        tips: 3
      });
      return false;
    }
    if(mibao_question==""||mibao_question==null){
        layer.tips('{$Think.lang.choose_code_que}','#mibao_question',{tips:3});
        return false;
    }
    if(mibao_answer==""||mibao_answer==null){
        layer.tips('{$Think.lang.input_que_ans}','#mibao_answer',{tips:3});
        return false;
    }
    $.post("{:U('User/upmibao')}",{chkstyle:chkstyle, email_verify:email_verify,mibao_question : mibao_question,mibao_answer : mibao_answer,new_mibao_question : new_mibao_question,new_mibao_answer:new_mibao_answer,findpwd_mibao:findpwd_mibao,findpaypwd_mibao:findpaypwd_mibao },function(data){
      if(data.status==1){
        layer.msg(data.info,{icon : 1 });
        window.location="{:U('User/mibao')}";
      }else{
        layer.msg(data.info,{icon : 2 });
        if(data.url){
          window.location=data.url;
        }
      }
    },"json");
  }
  function Update1(){
    var mibao_question='';
    var mibao_answer='';
    var new_mibao_question=$("#new_mibao_question").val();
    var new_mibao_answer=$("#new_mibao_answer").val();
	var chkstyle = 'email';
	if($("#findpwd_mibao").attr("checked")=="checked"){
		var findpwd_mibao = 1;
	}else{
		var findpwd_mibao = 0;
	}
	if($("#findpaypwd_mibao").attr("checked")=="checked"){
		var findpaypwd_mibao = 1;
	}else{
		var findpaypwd_mibao = 0;
	}
	if(!chkstyle){
		layer.tips('您选择验证方式！', '#chkstyle', {
			tips: 3
		});
		return false;
	}
/*    var mobile_verify = $("#mobile_verify").val();
    if (chkstyle == 'mobile' && (mobile_verify == "" || mobile_verify == null)) {
      layer.tips('请输入短信验证码', '#mobile_verify', {
        tips: 3
      });
      return false;
    }*/
	var email_verify = $("#email_verify").val();
    if (chkstyle == 'email' && (email_verify == "" || email_verify == null)) {
      layer.tips('{$Think.lang.g_yx_put_verfy}', '#email_verify', {
        tips: 3
      });
      return false;
    }
    if(new_mibao_question==""||new_mibao_question==null){
        layer.tips('{$Think.lang.choose_code_que}','#new_mibao_question',{tips:3});
        return false;
    }
    if(new_mibao_answer==""||new_mibao_answer==null){
        layer.tips('{$Think.lang.input_que_ans}','#new_mibao_answer',{tips:3});
        return false;
    }

    $.post("{:U('User/upmibao')}",{chkstyle:chkstyle, email_verify:email_verify, mibao_question : mibao_question,mibao_answer : mibao_answer,new_mibao_question : new_mibao_question,new_mibao_answer:new_mibao_answer,findpwd_mibao:findpwd_mibao,findpaypwd_mibao:findpaypwd_mibao},function(data){
      if(data.status==1){
        layer.msg(data.info,{icon : 1 });
        window.location="{:U('User/mibao')}";
      }else{
        layer.msg(data.info,{icon : 2 });
        if(data.url){
          window.location=data.url;
        }
      }
    },"json");
  }
	$("#mibao_answer").focus(function(){
		var mibaoquestion = $("#mibao_question").val();
		if(!mibaoquestion){
			layer.tips('{$Think.lang.choose_code_que}','#mibao_question',{tips:3});
		}
	});
	$("#mibao_answer").blur(function(){
		var mibaoanswer = $("#mibao_answer").val();
		if(!mibaoanswer){
			layer.tips('{$Think.lang.User_xzmbda}','#mibao_answer',{tips:3});
		}
	});
	$("#new_mibao_answer").focus(function(){
		var mibaoquestion = $("#new_mibao_question").val();
		if(!mibaoquestion){
			layer.tips('{$Think.lang.User_xzmbwt}','#new_mibao_question',{tips:3});
		}
	});
	$("#new_mibao_answer").blur(function(){
		var mibaoanswer = $("#new_mibao_answer").val();
		if(!mibaoanswer){
			layer.tips('{$Think.lang.User_xzmbda}','#new_mibao_answer',{tips:3});
		}
	});
/*	$("#mobile_verify").blur(function(){
		var mobileverify = $("#mobile_verify").val();
		if(!mobileverify){
			layer.tips('请填写短信验证码！','#mobile_verify',{tips:3});
		}
	});*/
	$("#chkstyle").change(function(){
		if($(this).val()=="mobile"){
			$("#mobile_div").show();
			$("#email_div").hide();
		}else if($(this).val()=="email"){
			$("#mobile_div").hide();
			$("#email_div").show();
		}
	});
	$("#findpwd_mibao").click(function(){
		if($(this).attr("checked")=="checked"){
			$(this).attr("checked",false);
		}else{
			$(this).attr("checked","checked");
		}
	});
	$("#findpaypwd_mibao").click(function(){
		if($(this).attr("checked")=="checked"){
			$(this).attr("checked",false);
		}else{
			$(this).attr("checked","checked");
		}
	});
</script>
<include file="Public:footer" />
</body>
</html>